Set proc = Server.CreateObject(ActiveExec.Process)
proc.NoWait = True or proc.NoWait = False (default)
String OutputStream [Read Only]
This is the output of a DOS/Console application. It is exactly as written to the console by the application, so if you need to write it to an HTML page you will probably need to enclose the output in PRE tags. This is not available if NoWait=true.
String InputStream [Write Only] newResponse.Write proc.OutputStream
String Expires [Read Only] newproc.InputStream = "input" & vbcrlf & "more input" & vbcrlf
proc.InputStream = "input" & vbcrlf & "more input" & vbcrlf
long ReturnCode [Read Only]
The Return Code of the last executed application. This is not available if NoWait=true.
Response.Write proc.ReturnCode
Any Win32 console application or other Windows application can be executed directly, as demonstrated below.proc.Execute 'C:\WINNT\System32\CMD.EXE /C "C:\path\to\dos\program.exe"'
If the program cannot execute, an error is returned. Below is a list of basic error codes. One thing to note, under ASP, you will need to make sure that the IUSR_SERVERNAME user has access to execute the application. This can be configured from the Security Tab under File Properties, or with CACLS from the command line.proc.Execute "C:\WINNT\System32\PING.EXE www.activitysoft.com"
LoadInputStream(Filename) new
Loads the contents of a file into the InputStream (buffer to be sent to the executing application). This is usually to be used with DOS/Console applications that understand STDIN/STDOUT.
List Of Basic Error Codesproc.LoadInputStream 'C:\TEMP\InputFile.TXT'
NO_ERROR 0 ERROR_INVALID_FUNCTION 1 ERROR_FILE_NOT_FOUND 2 ERROR_PATH_NOT_FOUND 3 ERROR_TOO_MANY_OPEN_FILES 4 ERROR_ACCESS_DENIED 5 ERROR_INVALID_HANDLE 6 ERROR_ARENA_TRASHED 7 ERROR_NOT_ENOUGH_MEMORY 8 ERROR_INVALID_BLOCK 9 ERROR_BAD_ENVIRONMENT 10 ERROR_BAD_FORMAT 11 ERROR_INVALID_ACCESS 12 ERROR_INVALID_DATA 13
<%@ LANGUAGE="VBSCRIPT" %> <% Set proc = Server.CreateObject("ActiveExec.Process") CommandLine = "C:\WINNT\System32\PING.EXE www.activitysoft.com" proc.Execute CommandLine Response.Write "Program " & CommandLine & " executed with return code " & _ proc.ReturnCode & "<BR>" Response.Write "Output is:" Response.Write "<BLOCKQUOTE><PRE>" Response.Write proc.OutputStream Response.Write "</PRE></BLOCKQUOTE>" %>